﻿@using Projectmanagement.Models
@{
    ViewBag.Title = "账号管理";
}


@(Html.Telerik().Grid<_EmployeeLocal>()
        .Name("账号管理")
    .DataKeys(keys => { keys.Add(item => item.ID); })
    .ToolBar(toolBar => toolBar.Insert())
    .DataBinding(dataBinding =>
    {
        dataBinding.Ajax()
            .Select("_SelectIndex", "Employee")
            .Insert("_InsertAjaxEditing", "Employee")
            .Update("_SaveAjaxEditing", "Employee")
            .Delete("_DeleteAjaxEditing", "Employee");
    })
    .Columns(columns =>
    {
        columns.Bound(item => item.EmployeeName).Width(240);
        columns.Bound(item => item.RoleName).Width(120);
        columns.Command(commands =>
        {
            commands.Edit();
            commands.Delete();
        }).Title("操作").Width(200);
    })
    .ClientEvents(events => events.OnEdit("onEdit"))
    .Editable(editing => editing.Mode(GridEditMode.PopUp))
    .Pageable(paging=>paging.Style(GridPagerStyles.Status).PageOnScroll(true).PageSize(50))
    .Scrollable(c => c.Height("570px"))
    .Resizable(resizing => resizing.Columns(true))
    .Sortable()
      )

<script>
    function onEdit(e) {
        var eid = e.dataItem["ID"];
        if (eid != 0) {
            $("#EmployeeID").attr("disabled", "disabled");
        } 
    }
</script>